<?php
header("content-type:text/html;charset=utf-8");

include_once "0.1conn.php"; //连接数据库

session_start();
if ($_POST['goodid'] == '') {
    $itemID = '%';
} else {
    $itemID = $_POST['goodid'];
}
if ($_POST['style'] == '') {
    $style = '%';
} else {
    $style = $_POST['style'];
}
if ($_POST['color'] == '') {
    $color = '%';
} else {
    $color = $_POST['color'];
}
if ($_POST['size'] == '') {
    $size = '%';
} else {
    $size = $_POST['size'];
}
if ($_POST['shopid'] == '') {
    $shop_id = '%';
} else {
    $shop_id = $_POST['shopid'];
}
$query = "SELECT * FROM clothes WHERE good_id LIKE '$itemID' AND style LIKE '$style' AND color LIKE '$color' AND size LIKE '$size' AND shop_id LIKE '$shop_id'";
$result = mysqli_query($conn, $query);
$arr = array();
if (mysqli_num_rows($result)) {
    //显示查询结果
    while ($row = mysqli_fetch_assoc($result)) {
        $arr[] = $row;
    }
    mysqli_free_result($result);
}
echo json_encode($arr);
mysqli_close($conn);
